/* style.css - 赛博机甲风 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: #0a0c12;
    color: #c0e0ff;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: 
        linear-gradient(rgba(0, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    position: relative;
}

/* 通用面板 */
.cyber-panel {
    background: rgba(10, 20, 30, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid #00f0ff;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.3), inset 0 0 10px rgba(0, 240, 255, 0.2);
    border-radius: 4px;
    padding: 1.5rem;
    position: relative;
}

.cyber-panel::before {
    content: '';
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    border: 1px solid rgba(255, 0, 255, 0.3);
    pointer-events: none;
    clip-path: polygon(0% 0%, 100% 0%, 95% 95%, 5% 95%);
}

/* 设置界面 */
.screen-center {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 1rem;
}

.setup-panel {
    max-width: 420px;
    width: 100%;
    text-align: center;
}

.glitch-title {
    font-size: 2.5rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #00ffff;
    text-shadow: 0.05em 0 0 #ff00ff, -0.05em -0.025em 0 #ffff00;
    letter-spacing: 4px;
    margin-bottom: 0.5rem;
    position: relative;
}

.neon-sub {
    color: #ff66ff;
    letter-spacing: 6px;
    font-size: 0.85rem;
    margin-bottom: 2rem;
    text-shadow: 0 0 5px magenta;
}

.input-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #00ffff;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.cyber-select {
    width: 100%;
    background: #0f1a24;
    border: 1px solid #00f0ff;
    color: #b0f0ff;
    padding: 0.75rem;
    font-family: 'Inter', monospace;
    border-radius: 0;
    appearance: none;
    outline: none;
    box-shadow: inset 0 0 8px #00f0ff40;
    cursor: pointer;
}

.cyber-select:hover {
    border-color: #ff66ff;
    box-shadow: 0 0 12px #ff66ff80;
}

.cyber-button {
    background: transparent;
    border: 2px solid #00ffff;
    color: #00ffff;
    padding: 0.9rem 2rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 3px;
    position: relative;
    cursor: pointer;
    transition: 0.2s;
    width: 100%;
    font-size: 1.2rem;
    box-shadow: 0 0 15px #00ffff;
}

.cyber-button:hover {
    background: #00ffff;
    color: #0a0c12;
    box-shadow: 0 0 30px #00ffff, inset 0 0 10px #ffffff;
    border-color: #ffffff;
}

.cyber-button.small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    letter-spacing: 2px;
    margin-top: 0.5rem;
}

/* 游戏主面板三栏 */
.game-dashboard {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 1.2rem;
    width: 98vw;
    max-width: 1600px;
    height: 90vh;
    padding: 1rem;
    margin: 0 auto;
}

.left-panel, .mid-panel, .right-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.panel-title {
    border-bottom: 2px solid #00ffff;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    color: #ff66ff;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 3px;
}

/* 玩家网格 */
.player-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 0.8rem;
    overflow-y: auto;
    padding-right: 4px;
}

.player-tile {
    background: #111c28;
    border: 2px solid #2a4a5a;
    aspect-ratio: 1/1.2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: bold;
    position: relative;
    clip-path: polygon(0% 0%, 100% 0%, 90% 100%, 10% 100%);
    transition: 0.15s;
    box-shadow: 0 0 0 1px #00f0ff40;
}

.player-tile.alive {
    border-color: #00ffaa;
    box-shadow: 0 0 12px #00ffaa80;
}

.player-tile.dead {
    border-color: #ff3355;
    opacity: 0.7;
    background: #1a1a2a;
}

.player-number {
    font-size: 1.5rem;
    line-height: 1;
    color: #fff;
    text-shadow: 0 0 5px cyan;
}

.player-status {
    font-size: 0.7rem;
    text-transform: uppercase;
}

.player-tile.dead .player-extra {
    font-size: 0.6rem;
    color: #ff8888;
    margin-top: 2px;
}

/* 中间操作区 */
.phase-indicator {
    display: flex;
    justify-content: space-between;
    background: #0f1f2f;
    padding: 0.5rem 1rem;
    border: 1px solid magenta;
    margin-bottom: 1rem;
    font-weight: 600;
}

.skill-panel {
    background: #0b141e;
    border: 1px solid #00aaff;
    padding: 1rem;
    margin-bottom: 1rem;
}

.skill-display {
    color: #aaffff;
    font-size: 0.9rem;
    margin: 0.5rem 0;
    padding: 0.5rem;
    background: #00000030;
    border-left: 4px solid #ff66ff;
}

.skill-uses {
    color: #ffcc00;
    font-size: 0.9rem;
}

.action-area {
    flex: 1;
    min-height: 120px;
    border: 1px dashed #00ffff;
    padding: 1rem;
    overflow-y: auto;
}

/* 夜间行动区域 - 动态生成的控件样式 */
#night-targets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin: 1rem 0;
}

#night-targets label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: #0f1f2f;
    border: 1px solid #00aaff;
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    color: #b0f0ff;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 0 5px #00aaff40;
}

#night-targets label:hover {
    border-color: #ff66ff;
    box-shadow: 0 0 12px #ff66ff80;
}

#night-targets input[type="radio"],
#night-targets input[type="checkbox"] {
    appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid #00f0ff;
    background: transparent;
    outline: none;
    cursor: pointer;
    position: relative;
}

#night-targets input[type="radio"] {
    border-radius: 50%;
}

#night-targets input[type="checkbox"] {
    border-radius: 2px;
}

#night-targets input[type="radio"]:checked,
#night-targets input[type="checkbox"]:checked {
    background: #00ffff;
    box-shadow: 0 0 10px #00ffff;
}

#night-targets input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: #0a0c12;
    border-radius: 50%;
    top: 2px;
    left: 2px;
}

#night-targets input[type="checkbox"]:checked::after {
    content: '✔';
    position: absolute;
    color: #0a0c12;
    font-size: 12px;
    font-weight: bold;
    top: -2px;
    left: 1px;
}

#night-targets input:disabled + span,
#night-targets input:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* 夜间行动按钮组 */
#submit-night-action,
#skip-night {
    background: transparent;
    border: 2px solid #00ffff;
    color: #00ffff;
    padding: 0.6rem 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: 0.2s;
    margin-right: 0.5rem;
    font-size: 0.9rem;
    box-shadow: 0 0 10px #00ffff;
}

#submit-night-action:hover,
#skip-night:hover {
    background: #00ffff;
    color: #0a0c12;
    box-shadow: 0 0 20px #00ffff;
    border-color: #fff;
}

#skip-night {
    border-color: #ff66ff;
    color: #ff66ff;
    box-shadow: 0 0 10px #ff66ff;
}

#skip-night:hover {
    background: #ff66ff;
    color: #0a0c12;
}

/* 投票区域 */
.vote-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.vote-grid button {
    background: #122b3a;
    border: 1px solid cyan;
    color: white;
    padding: 0.5rem;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 0.8rem;
    transition: 0.2s;
}

.vote-grid button:hover {
    background: cyan;
    color: black;
    font-weight: bold;
}

#submit-vote {
    background: transparent;
    border: 2px solid #ffaa00;
    color: #ffaa00;
    padding: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: 0.2s;
    margin-top: 1rem;
    width: 100%;
    font-size: 1rem;
    box-shadow: 0 0 15px #ffaa00;
}

#submit-vote:hover {
    background: #ffaa00;
    color: #0a0c12;
}

/* 结束发言按钮 */
#end-day-btn {
    background: transparent;
    border: 2px solid #ff44ff;
    color: #ff44ff;
    padding: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: 0.2s;
    margin: 0.5rem 0;
    width: 100%;
    font-size: 1rem;
    box-shadow: 0 0 15px #ff44ff;
}

#end-day-btn:hover {
    background: #ff44ff;
    color: #0a0c12;
}

/* 右侧通讯 */
.chat-area {
    flex: 1;
    overflow-y: auto;
    background: #0c121c;
    border: 1px solid #ff44ff;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chat-message {
    border-bottom: 1px solid #335577;
    padding: 0.3rem 0;
    font-size: 0.85rem;
}

.chat-sender {
    color: #00ffff;
    font-weight: 600;
}

.chat-system {
    color: #ffaa00;
}

/* 发言按钮 */
#speak-btn {
    background: transparent;
    border: 2px solid #00ffaa;
    color: #00ffaa;
    padding: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: 0.2s;
    margin-bottom: 0.5rem;
    width: 100%;
    font-size: 0.9rem;
    box-shadow: 0 0 10px #00ffaa;
}

#speak-btn:hover {
    background: #00ffaa;
    color: #0a0c12;
}

/* 下一阶段按钮 */
#next-phase-btn {
    background: transparent;
    border: 2px solid #00ccff;
    color: #00ccff;
    padding: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: 0.2s;
    margin-top: 0.5rem;
    width: 100%;
    font-size: 1rem;
    box-shadow: 0 0 15px #00ccff;
}

#next-phase-btn:hover {
    background: #00ccff;
    color: #0a0c12;
}

.hidden {
    display: none !important;
}

/* 胜利界面 */
.victory-panel {
    text-align: center;
    min-width: 400px;
}

.victory-msg {
    font-size: 2rem;
    color: #ff66ff;
    text-shadow: 0 0 20px magenta;
    margin: 2rem 0;
}

/* 滚动条 */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: #102030;
}
::-webkit-scrollbar-thumb {
    background: #00ffff;
    box-shadow: inset 0 0 6px #00ffff;
}

/* ========== 移动端响应式优化 ========== */
@media screen and (max-width: 768px) {
    /* 重置主面板为两列网格：左20% 右80%，上下分区 */
    .game-dashboard {
        display: grid;
        grid-template-columns: 20% 80%;
        grid-template-rows: auto 1fr;   /* 上行高度自适应，下行填满剩余 */
        grid-template-areas: 
            "left top"
            "left bottom";
        gap: 0.5rem;
        width: 100vw;
        height: 95vh;
        padding: 0.5rem;
        max-width: none;
    }

    .left-panel {
        grid-area: left;
        min-width: 0;           /* 防止内容溢出 */
        overflow: hidden;
        padding: 0.8rem;        /* 稍减小内边距 */
    }

    .mid-panel {
        grid-area: top;
        min-width: 0;
        overflow-y: auto;       /* 内容过多时可滚动 */
        padding: 0.8rem;
    }

    .right-panel {
        grid-area: bottom;
        min-width: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        padding: 0.8rem;
    }

    /* 左侧玩家网格：更小的头像格子 */
    .player-grid {
        grid-template-columns: repeat(auto-fill, minmax(35px, 1fr));
        gap: 0.3rem;
    }

    .player-tile {
        clip-path: none;                /* 简化形状，避免渲染问题 */
        padding: 0.2rem 0;
        aspect-ratio: 1/1.1;            /* 稍扁一点以显示文字 */
    }

    .player-number {
        font-size: 1rem;
    }

    .player-status {
        font-size: 0.45rem;
        line-height: 1.2;
    }

    .player-extra {
        font-size: 0.4rem;
    }

    /* 隐藏面板标题中的图标（可选，节省空间） */
    .panel-title i {
        display: none;
    }

    .panel-title {
        font-size: 0.85rem;
        letter-spacing: 1px;
        padding-bottom: 0.3rem;
        margin-bottom: 0.5rem;
    }

    /* 中间区域文字与间距微调 */
    .phase-indicator {
        font-size: 0.75rem;
        padding: 0.3rem;
        margin-bottom: 0.5rem;
    }

    .skill-panel {
        padding: 0.6rem;
        margin-bottom: 0.5rem;
    }

    .skill-panel h3 {
        font-size: 0.9rem;
        margin: 0 0 0.3rem;
    }

    .skill-display,
    .skill-uses {
        font-size: 0.75rem;
    }

    .action-area {
        padding: 0.5rem;
        max-height: 35vh;                /* 防止过高，允许滚动 */
        overflow-y: auto;
    }

    /* 夜间行动控件改为纵向，便于触摸 */
    #night-targets {
        flex-direction: column;
        gap: 0.4rem;
        margin: 0.5rem 0;
    }

    #night-targets label {
        width: 100%;
        padding: 0.6rem;
        font-size: 0.8rem;
        justify-content: flex-start;
    }

    /* 按钮区域：增大点击区域，统一尺寸 */
    .cyber-button,
    #submit-night-action,
    #skip-night,
    #speak-btn,
    #end-day-btn,
    #submit-vote,
    #next-phase-btn {
        padding: 0.7rem 0.5rem;
        font-size: 0.85rem;
        margin: 0.2rem 0;
    }

    /* 投票按钮网格双列，易点 */
    .vote-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.3rem;
    }

    .vote-grid button {
        padding: 0.7rem 0.3rem;
        font-size: 0.75rem;
    }

    /* 右侧聊天区域填满剩余高度 */
    .chat-area {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        font-size: 0.75rem;
        padding: 0.5rem;
    }

    .chat-message {
        padding: 0.2rem 0;
    }

    /* 设置界面、胜利界面适配小屏 */
    .setup-panel {
        max-width: 90%;
        padding: 1rem;
    }

    .glitch-title {
        font-size: 2rem;
        letter-spacing: 2px;
    }

    .neon-sub {
        font-size: 0.7rem;
        letter-spacing: 3px;
    }

    .victory-panel {
        min-width: auto;
        width: 90%;
    }

    .victory-msg {
        font-size: 1.6rem;
    }

    /* 调整body垂直对齐，使面板更靠上（可选） */
    body {
        align-items: flex-start;
        padding-top: 1vh;
    }
}

/* 针对更小屏（如宽度≤480px）进一步微调 */
@media screen and (max-width: 480px) {
    .game-dashboard {
        grid-template-columns: 22% 78%;   /* 左列稍微加宽保证可点 */
    }

    .player-number {
        font-size: 0.9rem;
    }

    .player-status {
        font-size: 0.4rem;
    }

    .panel-title {
        font-size: 0.75rem;
    }

    .cyber-button,
    #submit-night-action,
    #skip-night,
    #speak-btn,
    #end-day-btn,
    #submit-vote,
    #next-phase-btn {
        padding: 0.6rem 0.3rem;
        font-size: 0.8rem;
    }

    #night-targets label {
        padding: 0.5rem;
    }
}